package com.csun.cmny.provider.dao;

import com.csun.cmny.provider.model.domain.DmcCsunVersionSetDevice;
import com.csun.cmny.provider.model.domain.DmcDevice;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface DmcCsunVersionSetDeviceMapper extends Mapper<DmcCsunVersionSetDevice> {

    /**
     * batch update csun version set device stat
     *
     * @param versionSetId the version set id
     * @param deviceIdList the device id list
     * @param before       the before stat
     * @param stat         the stat
     *
     * @return the int.
     */
    Integer batchUpdateStat(@Param("versionSetId") Long versionSetId,
                            @Param("deviceIdList") List<Long> deviceIdList,
                            @Param("before") Integer before,
                            @Param("stat") Integer stat);

    /**
     * query device id list
     *
     * @param versionSetId the version set id
     * @param stat         the stat
     *
     * @return the list.
     */
    List<DmcDevice> queryDeviceIdList(@Param("versionSetId") Long versionSetId,
                                      @Param("stat") Integer stat);

    /**
     * 批量更新设备升级状态
     *
     * @param dmcCsunVersionSetDeviceList the list of dmc csun version set device
     *
     * @return the int.
     */
    Integer batchUpdate(@Param("dmcCsunVersionSetDeviceList") List<DmcCsunVersionSetDevice> dmcCsunVersionSetDeviceList);

    /**
     * update dmc csun version set device stat by task id
     *
     * @param taskId the task id
     * @param stat   the stat
     *
     * @return the int.
     */
    Integer updateByTaskId(@Param("taskId") String taskId, @Param("stat") int stat);

    /**
     * update by time and stat
     *
     * @param time   the time
     * @param before the before
     * @param after  the after
     *
     * @return the int.
     */
    Integer updateByTimeAndStat(@Param("time") String time,
                                        @Param("before") int before,
                                        @Param("after") int after);
}